home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!iiga.demon.co.uk
- From: Pete Ryan <pete@iiga.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Returning a variable from system() function
- Date: Fri, 19 Jan 1996 10:04:20 GMT
- Organization: None
- Message-ID: <295336694wnr@iiga.demon.co.uk>
- Reply-To: pete@iiga.demon.co.uk
- X-NNTP-Posting-Host: iiga.demon.co.uk
- X-Broken-Date: Friday, Jan 19, 1996 10.04.20
- X-Newsreader: Newswin Alpha 0.7
- X-Mail2News-Path: relay-4.mail.demon.net!post.demon.co.uk!iiga.demon.co.uk
-
- Hiya,
- I`ve just been experimenting with C on UNIX and have come across a
- problem!. There is a UNIX command called `find / -name gwire -print`
- which scans the UNIX drive for files/directories containing `gwire`.
- Anyway what I want to do is the following...
-
- #include <stdio.h>
- #include <stdlib.h>
- etc
-
- void main()
- {
- char tmp[];
-
- chdir("/usr2/willesden");
-
- */ offending code below ;( */
- tmp = system("find . -name gwire");
-
- printf("%s",tmp");
-
- }
-
- Therefore if I run `find . -name gwire -print` it returns all the
- directories containing `gwire`. However the code above does not
- work!!. Is it because `= system` returns an integer and not strings???
-
- Any help would be very much appreciated as I have only just started
- learning c in the last 2 months.
-
-
- -------------------------------|
- | EMail pete@ |
- | Mail sent via Demon Internet |
- --------------------------------
-
-